package com.hbnu.thread;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author kittychen
 * @since 2025-10-21 16:37
 */
public class ThreadTest {
    public static void main(String[] args) {
        for (int i = 100; i < 200; i++) {
            System.out.print(i + "\t");
        }
        System.out.println();
        ThreadDemo01 threadDemo01 = new ThreadDemo01();
        threadDemo01.setPriority(8);
        threadDemo01.start();   // 启动线程

        ThreadDemo02 threadDemo02 = new ThreadDemo02();
        new Thread(threadDemo02).start();  // 启动线程

        FutureTask<String> futureTask = new FutureTask<String>(new ThreadDemo03());
        new Thread(futureTask).start();  // 启动线程
        try {
            String result = futureTask.get();
            System.out.println(result);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}
